////////////////////////////////////////////////////////////////////////////
// Copyright (c) 2012 Kentaro Sekimoto  All rights reserved.
////////////////////////////////////////////////////////////////////////////

#include <tinyhal.h>

#ifdef TEST_AD
#define AD_CH    (16)

void TestAD(void)
{
    ANALOG_CHANNEL channel = (ANALOG_CHANNEL)AD_CH;
    AD_Initialize(channel, 12);
    GPIO_PIN pin = AD_GetPinForChannel(channel);

    UINT32 i = 100;
    while (i-- >0) {
        UINT32 value = AD_Read(channel);
        Events_WaitForEvents(0, 1000);
        hal_printf("A/D %04d\r\n", value);
        lcd_printf("A/D %04d\r\n", value);
    }
}
#endif
